package com.imooc.alllearning.domain.dto;

import com.imooc.alllearning.util.InsertValidationGroup;
import com.imooc.alllearning.util.UpdateValidationGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户DTO实体
 * Created by lijian on 2020/3/27 10:04
 */
@Data
public class UserDTO implements Serializable {

    private static final long serialVersionUID = 5772982848133199132L;
    @NotBlank(message = "用户名不能为空！", groups = {InsertValidationGroup.class})
    private String username;//用户名
    @NotBlank(message = "密码不能为空！", groups = {InsertValidationGroup.class})
    @Length(min = 6, max = 18, message = "密码不能小于6位，不能多余18位！")
    private String password;//密码
    @NotEmpty(message = "邮箱不能为空！",groups = {InsertValidationGroup.class})
    @Email(message = "必须为有效的邮箱！")
    private String email;//邮箱
    @NotNull(message = "年龄不能为空！",groups = {InsertValidationGroup.class})
    @Min(value = 18, message = "年龄不能小于18岁！")
    @Max(value = 60, message = "年龄不能大于60岁！")
    private Integer age;//年龄
    @NotBlank(message = "电话不能为空！", groups = {InsertValidationGroup.class})
    private String phone;//电话
    @NotNull(message = "版本号不能为空！", groups = {UpdateValidationGroup.class})
    private Long version;//版本号
    private Date created;//创建时间
}
